package com.primb.bench.project.home.activity;

import android.content.Intent;
import android.os.Bundle;
import android.os.Parcelable;
import android.support.annotation.Nullable;
import android.widget.TextView;

import com.primb.baselibs.util.FormatUtils;
import com.primb.baselibs.view.AutoToolbar;
import com.primb.bench.R;
import com.primb.bench.base.SwipeBaseActivity;
import com.primb.bench.project.home.entity.HttpResultEntity;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * Created by Chen on 2017/9/18.
 * 功能描述：
 * 作者：Chen
 */

public class LoanParameterActivity extends SwipeBaseActivity {

    @BindView(R.id.title_bar)
    TextView titleBar;
    @BindView(R.id.tool_bar)
    AutoToolbar toolBar;
    @BindView(R.id.tv_parameter_money_cost)
    TextView tvParameterMoneyCost;
    @BindView(R.id.tv_parameter_loan_all_run)
    TextView tvParameterLoanAllRun;
    @BindView(R.id.tv_parameter_loan_change_run)
    TextView tvParameterLoanChangeRun;
    @BindView(R.id.tv_parameter_deposit_all_run)
    TextView tvParameterDepositAllRun;
    @BindView(R.id.tv_parameter_deposit_change_run)
    TextView tvParameterDepositChangeRun;
    @BindView(R.id.tv_parameter_expect_loss)
    TextView tvParameterExpectLoss;
    @BindView(R.id.tv_parameter_default_chance)
    TextView tvParameterDefaultChance;
    @BindView(R.id.tv_parameter_default_loss)
    TextView tvParameterDefaultLoss;
    @BindView(R.id.tv_parameter_capital_cost)
    TextView tvParameterCapitalCost;
    @BindView(R.id.tv_parameter_capital_occupy)
    TextView tvParameterCapitalOccupy;
    @BindView(R.id.tv_parameter_capital_return)
    TextView tvParameterCapitalReturn;
    @BindView(R.id.tv_parameter_target_return)
    TextView tvParameterTargetReturn;
    @BindView(R.id.tv_parameter_point_djust)
    TextView tvParameterPointDjust;
    @BindView(R.id.tv_parameter_point_used)
    TextView tvParameterPointUsed;
    @BindView(R.id.tv_parameter_point_remaining)
    TextView tvParameterPointRemaining;
    private HttpResultEntity.DataBean info;

    @Override
    protected void onBaseIntent() {
        super.onBaseIntent();
        Intent intent = getIntent();
        info = intent.getParcelableExtra("info");
    }

    @Override
    protected int onBaseLayoutId(@Nullable Bundle savedInstanceState) {
        return R.layout.activity_loan_parameter;
    }

    @Override
    protected void onBaseBindView() {
        titleBar.setText("定价参数信息");
        toolBar.setNavigationOnClickListener(v -> LoanParameterActivity.this.finish());
        try {
            tvParameterMoneyCost.setText(FormatUtils.format(Double.valueOf(info.getLncFtpRate()) * 100));
            tvParameterLoanAllRun.setText(FormatUtils.format(Double.valueOf(info.getLncFeeRate()) * 100));
            tvParameterLoanChangeRun.setText(FormatUtils.format(Double.valueOf(info.getLncFeeBdRate()) * 100));
            tvParameterDepositAllRun.setText(FormatUtils.format(Double.valueOf(info.getDepFee()) * 100));
            tvParameterDepositChangeRun.setText(FormatUtils.format(Double.valueOf(info.getDppBdFee()) * 100));
            tvParameterExpectLoss.setText(FormatUtils.format(Double.valueOf(info.getElRate()) * 100));
            tvParameterDefaultChance.setText(FormatUtils.format(Double.valueOf(info.getLncPd()) * 100));
            tvParameterDefaultLoss.setText(FormatUtils.format(Double.valueOf(info.getLncLgd()) * 100));
            tvParameterCapitalCost.setText(FormatUtils.format(Double.valueOf(info.getCapCostRate()) * 100));
            tvParameterCapitalOccupy.setText(FormatUtils.format(Double.valueOf(info.getLncEcPara()) * 100));
            tvParameterCapitalReturn.setText(FormatUtils.format(Double.valueOf(info.getLncLowCapRet()) * 100));
            tvParameterTargetReturn.setText(FormatUtils.format(Double.valueOf(info.getLncPrdTarRet()) * 100));
            tvParameterPointDjust.setText(FormatUtils.format(Double.valueOf(info.getLnDiscountValue()) * 100));
            tvParameterPointUsed.setText(info.getLncScoreUse());
            tvParameterPointRemaining.setText(info.getLncScoreleft());
        } catch (Exception e) {
            showAlterDialogOne("提示", "服务器返参数格式异常");
        }
    }

    @Override
    protected void onLoadData() {

    }
}
